
import React, { Component } from 'react';
import { StyleSheet, TouchableHighlight, Text, View, ScrollView } from 'react-native';
import NineBlockBox from './nineBlockBox';
import TestViewCenter from './testViewCenter';


const styles = StyleSheet.create({
    containerScrollView: {
        flex: 1,
        backgroundColor:'#F2F2F2'
    },
    container:{
        flex:1,
        backgroundColor:'#F2F2F2'
    }
});

const data = [
    {
        name:'酒店',
        img:'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/%E6%9C%AA%E6%A0%87%E9%A2%98-1.png',
        desc1:'海外',
        desc2:'周边',
        info1:'团购.特惠',
        info2:'客栈.公寓',
        bgColor:'#FA6778',
        borderColor:'#FA6778'
    },
    {
        name:'机票',
        img:'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/feiji.png',
        desc1:'火车票',
        desc2:'接收机',
        info1:'汽车票',
        info2:'自驾.专车',
        bgColor:'#3D98FF',
        borderColor:'#3D98FF'
    },
    {
        name:'旅游',
        img:'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/lvyou.png',
        desc1:'门票.玩乐',
        desc2:'出境WiFi',
        info1:'邮轮',
        info2:'签证',
        bgColor:'#5EBE00',
        borderColor:'#5EBE00'
    },
    {
        name:'酒店',
        img:'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/gonglue.png',
        desc1:'周末游',
        desc2:'礼品卡',
        info1:'美食.购物',
        info2:'更多',
        bgColor:'#FC9720',
        borderColor:'#FC9720'
    }
];


class SecondPageView extends Component {

    _showInformation(dataArr){
        if (dataArr && dataArr.length){
            let list = dataArr.map((p, i)=>{
                const _key = 'nine'+i;
                return (<NineBlockBox key={_key} params={p}/>);
            });
            return (<View style={{marginTop:10}}>{list}</View>);
        }
        return <View/>;
    }

    render(){
        return (
            <ScrollView style={styles.containerScrollView}>
                <View style={styles.container}>
                    {this._showInformation(data)}
                    <TestViewCenter/>
                </View>
            </ScrollView>
        );
    }
}

export default SecondPageView;